import Taro from '@tarojs/taro'
import { useEffect, useState } from 'react'

export default function useNavigateBar() {
  const [navBarHeight, setNavBarHeight] = useState(0)
  const [navStatusBarHeight, setNavStatusBarHeight] = useState(0)

  useEffect(() => {
    getStatusBarHeight()
  }, [])

  async function getStatusBarHeight() {
    const { statusBarHeight = 0 } = await Taro.getSystemInfo()
    setNavBarHeight(statusBarHeight + 43)
    setNavStatusBarHeight(statusBarHeight);
  }

  return {
    navBarHeight,
    navStatusBarHeight
  }
}
